package com.atlin.model;

import com.atlin.exception.CustomException;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * 客户端信息参数模型
 */
@Data
public class ServerInfoModel implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * IP地址
     */
    private List<String> ipAddress;

    /**
     * MAC地址
     */
    private List<String> macAddress;

    /**
     * CPU序列号
     */
    private String cpuSerial;

    /**
     * 主板序列号
     */
    private String mainBoardSerial;

    /**
     * 机器码
     */
    private String machineCode;

    /**
     * 空项校验
     */
    public void valid() {
        if (ipAddress == null || ipAddress.isEmpty() || macAddress == null || macAddress.isEmpty() || StringUtils.isAnyBlank(cpuSerial, mainBoardSerial)) {
            throw new CustomException("服务器指纹信息数据存在空项");
        }
    }
}
